import 'package:backend.core/core/domain/entities/web/web_money_amount.dart';
import 'package:backend.core/core/domain/entities/web/web_purchased_subscription_transaction.dart';
import 'package:backend.core/core/domain/entities/web/web_purchased_subscription_transaction_offer_type.dart';
import 'package:backend.core/core/domain/entities/web/yookassa/yookassa_transaction.dart';
import 'package:backend.core/core/domain/entities/web/yookassa/yookassa_transaction_revocation_info.dart';

class YookassaPurchasedSubscriptionTransaction extends YookassaTransaction
    implements WebPurchasedSubscriptionTransaction {
  const YookassaPurchasedSubscriptionTransaction({
    required this.id,
    required this.originalTransactionId,
    required this.userId,
    required this.purchaseItemSku,
    required this.paymentMethodId,
    required this.time,
    required this.amount,
    required this.offerType,
    required this.yookassaPaymentId,
    required this.revocationInfo,
    required this.incomeAmount,
    required this.test,
  });

  @override
  final String id;

  @override
  final String originalTransactionId;

  @override
  final String userId;

  @override
  final String purchaseItemSku;

  @override
  final String paymentMethodId;

  @override
  final DateTime time;

  @override
  final WebMoneyAmount amount;

  @override
  final WebPurchasedSubscriptionTransactionOfferType offerType;

  @override
  final bool test;

  @override
  final String yookassaPaymentId;

  @override
  final WebMoneyAmount incomeAmount;

  @override
  final YookassaTransactionRevocationInfo? revocationInfo;

  @override
  List<Object?> get props {
    return [
      id,
      originalTransactionId,
      userId,
      purchaseItemSku,
      paymentMethodId,
      amount,
      offerType,
      time,
      yookassaPaymentId,
      revocationInfo,
      test,
      incomeAmount,
    ];
  }

  @override
  YookassaPurchasedSubscriptionTransaction copyWith({
    String Function()? id,
    String Function()? originalTransactionId,
    String Function()? userId,
    String Function()? purchaseItemSku,
    String Function()? paymentMethodId,
    DateTime Function()? time,
    WebMoneyAmount Function()? amount,
    WebPurchasedSubscriptionTransactionOfferType Function()? offerType,
    bool Function()? test,
    String Function()? yookassaPaymentId,
    WebMoneyAmount Function()? incomeAmount,
    YookassaTransactionRevocationInfo? Function()? revocationInfo,
  }) {
    return YookassaPurchasedSubscriptionTransaction(
      id: id == null ? this.id : id(),
      originalTransactionId:
          originalTransactionId == null ? this.originalTransactionId : originalTransactionId(),
      userId: userId == null ? this.userId : userId(),
      purchaseItemSku: purchaseItemSku == null ? this.purchaseItemSku : purchaseItemSku(),
      paymentMethodId: paymentMethodId == null ? this.paymentMethodId : paymentMethodId(),
      time: time == null ? this.time : time(),
      amount: amount == null ? this.amount : amount(),
      offerType: offerType == null ? this.offerType : offerType(),
      test: test == null ? this.test : test(),
      yookassaPaymentId: yookassaPaymentId == null ? this.yookassaPaymentId : yookassaPaymentId(),
      incomeAmount: incomeAmount == null ? this.incomeAmount : incomeAmount(),
      revocationInfo: revocationInfo == null ? this.revocationInfo : revocationInfo(),
    );
  }
}
